<?php 
include("../includes/functions.php");
//--------------------------------
if(isset($_POST['Submit']))
{
	$eml = mysql_real_escape_string($_POST['eml']);
	
	if(!empty($eml))
	{
		$q = $con->select_query("admin","*","where aemail = '$eml'");
		if($r = mysql_fetch_object($q))
		{
			$pass = $r->adminps;
			$aun = $r->adminun;
			$subject = "Administrator Login Info";
			$sender = $r->sender;
			$senderEmail = $r->senderemail;
			$domain = $r->domain ;
			$body = "Dear Administartor<br><br>Please note your login details for $domain administration area:<br><br>
			Admin User Name: $aun<br>Admin Password: $pass<br><br>Thank You<br>$domain";
				
				require_once("../includes/class.phpmailer.php");
				$Smailer = new PHPMailer();
				$Smailer->From = $senderEmail;
				$Smailer->FromName = $sender ;					
				$Smailer->Subject = $subject ; 
				$Smailer->IsHTML(true);	
				$Smailer->Body = $body;
				$Smailer->AddAddress($eml);
				$Smailer->Send();
				unset($Smailer);
			
				$mess = getADMSuccess("Login details have been emailed.");			
		}
		else
		{
			$mess = getADMError("Invalid login credectials.");	
		}
	}
	else
	{
		$mess = getADMError("You must enter administrator username/password.");
	}	

}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	
	<title><?php echo $title;?></title>
	
    <style type="text/css" media="all">
		@import url("css/style.css");
		@import url("css/jquery.wysiwyg.css");
		@import url("css/facebox.css");
		@import url("css/visualize.css");
		@import url("css/date_input.css");
    </style>
	
	<!--[if lt IE 8]><style type="text/css" media="all">@import url("css/ie.css");</style><![endif]-->

</head>




<body>
	
	<div id="hld">
	
		<div class="wrapper">		<!-- wrapper begins -->
		
		
		
		
		
		
			
			
			
			
			
			
			
			<div class="block small center login">
			
				<div class="block_head">
					<div class="bheadl"></div>
					<div class="bheadr"></div>
					
					<h2>FoodYaLove CMS - Forgot password</h2>
					<ul>
						<li></li>
					</ul>
				</div>		<!-- .block_head ends -->
				
				
				
				
				<div class="block_content">
					
					<?php echo $mess; ?>
					
					<form action="forgot.php" method="post" autocomplete="OFF">
						<p>
							<label>Email:</label> <br />
							<input type="text" class="text" name='eml' />
						</p>
						<p>
					  <input name="Submit" type="submit" class="submit mid" value="Send Password" /><br /><br />
                      <small><a href="login.php">click here to login</a></small></p>
				  </form>
					
				</div>		<!-- .block_content ends -->
					
				<div class="bendl"></div>
				<div class="bendr"></div>
								
			</div>		<!-- .login ends -->
			
			
			
			
			
			
			
			
			
			
			
		
		
		</div>						<!-- wrapper ends -->
		
	</div>		<!-- #hld ends -->
	
	
	<!--[if IE]><script type="text/javascript" src="js/excanvas.js"></script><![endif]-->	
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/jquery.img.preload.js"></script>
	<script type="text/javascript" src="js/jquery.filestyle.mini.js"></script>
	<script type="text/javascript" src="js/jquery.wysiwyg.js"></script>
	<script type="text/javascript" src="js/jquery.date_input.pack.js"></script>
	<script type="text/javascript" src="js/facebox.js"></script>
	<script type="text/javascript" src="js/jquery.visualize.js"></script>
	<script type="text/javascript" src="js/jquery.visualize.tooltip.js"></script>
	<script type="text/javascript" src="js/jquery.select_skin.js"></script>
	<script type="text/javascript" src="js/jquery.tablesorter.min.js"></script>
	<script type="text/javascript" src="js/ajaxupload.js"></script>
	<script type="text/javascript" src="js/jquery.pngfix.js"></script>
	<script type="text/javascript" src="js/custom.js"></script>
	
	
</body>
</html>